﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace nSL.Libs
{
    public class DirectoryHelper
    {
        public static bool Empty(string dir)
        {
            try
            {
                System.IO.DirectoryInfo directory = new System.IO.DirectoryInfo(dir);
                foreach (System.IO.FileInfo file in directory.GetFiles()) file.Delete();
                foreach (System.IO.DirectoryInfo subDirectory in directory.GetDirectories()) subDirectory.Delete(true);
                return true;
            }
            catch
            {
                return false;
            }
        }
    }
}
